﻿Imports CoreFX
Imports CoreFX.Interfaces
Imports Microsoft.VisualBasic.Devices
Imports Microsoft.VisualBasic.Interaction
Public Class Application
    Private Sub Application_DispatcherUnhandledException(ByVal sender As Object, ByVal e As System.Windows.Threading.DispatcherUnhandledExceptionEventArgs) Handles Me.DispatcherUnhandledException
        MsgBox(e.Exception.ToString, Microsoft.VisualBasic.MsgBoxStyle.Critical, "MChat Critical Error")
        e.Handled = True
    End Sub
    Private Sub Application_Startup(ByVal sender As Object, ByVal e As System.Windows.StartupEventArgs) Handles Me.Startup
        Dim vbNet As New Network
        [Global].Services.Add(Of ILogging)(New Logging.LoggerMain(Logging.HighestShowableMsg.All))
        [Global].Services.Get(Of ILogging).AddItem("MChat Beta 1 Build " & My.Application.Info.Version.BuildString, Logging.MessageType.NameVer)
        AddHandler vbNet.NetworkAvailabilityChanged, AddressOf IsConnectedChanged
    End Sub
    Private Sub IsConnectedChanged(ByVal sender As Object, ByVal E As NetworkAvailableEventArgs)
        ChatEngine.Connections.IRCConnection.IsConnectedVar = E.IsNetworkAvailable
    End Sub
End Class